home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Sunday Times: The Month 2003 December
/
The Sunday Times - The Month 2003-12.iso
/
mac
/
The Month DEC 03
/
engine
/
modules
/
musts.swf
/
scripts
/
frame_1
/
DoAction.as
Wrap
Text File
|
2003-09-04
|
5KB
|
202 lines
function loadImage(mc, node, extrapath)
{
extrapath != null ? 0 : (extrapath = "");
var strDefaultPath = Tardis.ASSETS_FOLDER + "images/" + Tardis.ActiveSection.id + "/";
var strImg = node.getText();
var diffpath = node.attributes.path;
if(diffpath != null)
{
strImg = diffpath + strImg;
}
else
{
strImg = strDefaultPath + extrapath + strImg;
}
strPathPrefix != null ? 0 : (strPathPrefix = "");
mc.loadMovie(strPathPrefix + strImg);
}
function addLink(mc)
{
Links[mc.link] = mc;
}
function getMCfromLink(Item)
{
if(Links[Item] == null)
{
var arr = [];
while(Item != sideMenu.ItemHome)
{
arr.unshift(Item._name.split("_").pop());
Item = Item._parent._parent;
}
var str = arr.join("/");
Links[Item] = Links[str];
}
return Links[Item];
}
function removeLinkListener()
{
Tardis.sideMenu.EB.removeListener(this);
}
function init()
{
build();
}
function build()
{
var strID = Tardis.ActiveSection.id;
var Colors = Tardis.Colors;
strSECTION_COLOR = Colors.getString(strID);
strSECTION_COLOR50 = Colors.getString(strID + "50");
SECTION_COLOR = Colors.getHex(strID);
SECTION_COLOR50 = Colors.getHex(strID + "50");
DEFAULT_COLOR = Colors.getHex("default");
strDEFAULT_COLOR = Colors.getString("default");
DEFAULT_COLOR50 = Colors.getHex("default50");
ndExtras = nodeData;
LENGTH_TO_TEST = ndExtras.childNodes.length;
COUNTER = 0;
countComplete = false;
IMAGE_POS_1 = 0;
var ndExtra;
var n = 0;
while(n < LENGTH_TO_TEST)
{
CONTENT_POS = 0;
ndExtra = ndExtras.childNodes[n];
var objClip = this.attachMovie("tvListingMC","mc_t_" + n,++depth);
objClip.positioned = false;
objClip.col = ndExtra.attributes.col;
objClip.link = ndExtra.attributes.link;
if(ndExtra.byName("title").getText() != null)
{
var strTitle = "<FONT COLOR=\"" + strSECTION_COLOR50 + "\">" + ndExtra.byName("title").getText() + " </FONT>";
objClip.titleFF.htmlText = strTitle;
objClip.titleFF.resize();
objClip.titleFF._y = CONTENT_POS;
CONTENT_POS += objClip.titleFF._height + 2;
}
ndImage = ndExtra.byName("image");
if(ndImage.getText() != null)
{
loadImage(objClip.mc_img_0,ndImage,IMAGE_PATH);
if(n != 0)
{
if(CONTENT_POS < IMAGE_POS_1)
{
objClip.mc_img_0._y = IMAGE_POS_1;
}
else if(IMAGE_POS_1 < CONTENT_POS)
{
mc_t_0.mc_img_0._y = CONTENT_POS;
objClip.mc_img_0._y = CONTENT_POS;
}
else
{
objClip.mc_img_0._y = CONTENT_POS;
}
}
else
{
IMAGE_POS_1 = CONTENT_POS;
objClip.mc_img_0._y = CONTENT_POS;
}
this["intervalID" + n] = setInterval(this,"checkLoad",100,objClip,n);
}
else
{
objClip.mc_img_0._height = 0;
objClip.mc_img_0._y = 0;
objClip.title2FF._height = 0;
objClip.title2FF._y = 0;
COUNTER++;
}
n++;
}
counterID = setInterval(checkCounter,100);
onComplete();
}
function checkCounter()
{
if(COUNTER == LENGTH_TO_TEST)
{
if(!countComplete)
{
countComplete = true;
positionElements();
clearInterval(counterID);
}
}
}
function checkLoad(mc, num)
{
if(mc.mc_img_0._height > 0)
{
if(!mc.positioned)
{
mc.positioned = true;
COUNTER++;
clearInterval(this["intervalID" + num]);
}
}
}
function positionElements(mc)
{
positionFF.htmlText = POSI;
var ndExtra;
var n = 0;
while(n < LENGTH_TO_TEST)
{
var objClip = eval("mc_t_" + n);
objClip.btn._height = objClip._height;
objClip._x = eval("COLPOS_" + objClip.col);
objClip._y = eval("TEXTPOS_" + objClip.col);
this["TEXTPOS_" + objClip.col] += objClip._height - 3;
n++;
}
_visible = true;
}
function txtOver(mc)
{
Tardis.sideMenu.doOver(mc.link);
}
function txtOut(mc)
{
Tardis.sideMenu.doOut(mc.link);
}
function doOver(nm)
{
var mc = eval("mc_t_" + nm);
mc.titleFF.textColor = SECTION_COLOR;
_parent.preview.doOver(nm);
}
function doOut(nm)
{
var mc = eval("mc_t_" + nm);
mc.titleFF.textColor = SECTION_COLOR50;
_parent.preview.doOut(nm);
}
Links = {};
Tardis.sideMenu.EB.addListener(this);
stop();
_visible = false;
TEXTPOS_1 = 5;
TEXTPOS_2 = 5;
COLPOS_1 = 8;
COLPOS_2 = 188;
CONTENT_POS = 0;
objpos = 0;
onReady();
this.onUnload = function()
{
clearInterval(counterID);
var n = 0;
while(n < LENGTH_TO_TEST)
{
clearInterval(this["intervalID" + n]);
n++;
}
removeLinkListener();
this.onUnload = null;
};